class Deliverer
  def initialize(mail, recipients, admin)
    @mail = mail
    @recipients = recipients
    @admin = admin
  end

  def deliver
    Domain.all.to_a.map(&:queue_name_part).uniq.each do |domain_name|
      delivery = Delivery.create promotion_mail: @mail,
                                 admin: @admin,
                                 domain_name: domain_name
      delivery.start(@recipients)
    end
  end

end